package 数据结构.链表.单链表;
//测试demo
public class SingleLinkedListDemo {
    public static void main(String[] args) {
//   先创建几个案例
        HeroNode heroNode = new HeroNode(1, "宋江", "及时雨");
        HeroNode heroNode1 = new HeroNode(2, "卢俊义", "玉麒麟");
        HeroNode heroNode2 = new HeroNode(3, "吴用", "智多星");
        HeroNode heroNode3 = new HeroNode(4, "林冲", "豹子头");
        HeroNode heroNode5 = new HeroNode(5, "林冲", "豹子头");
        HeroNode heroNode6 = new HeroNode(6, "林冲", "豹子头");
        HeroNode heroNode7 = new HeroNode(7, "林冲", "豹子头");
        HeroNode heroNode8 = new HeroNode(8, "林冲", "豹子头");
        HeroNode heroNode4 = new HeroNode(4, "连安利", "豹子头零充");


        SingleLinkedList singleLinkedList = new SingleLinkedList();
        //        不按编号创建要给链表
  /*      singleLinkedList.add(heroNode);
        singleLinkedList.add(heroNode1);
        singleLinkedList.add(heroNode2);
        singleLinkedList.add(heroNode3);
        */
//        按编号创建
        singleLinkedList.addByOrder(heroNode1);
        singleLinkedList.addByOrder(heroNode);
        singleLinkedList.addByOrder(heroNode2);
        singleLinkedList.addByOrder(heroNode3);
        singleLinkedList.addByOrder(heroNode5);
        singleLinkedList.addByOrder(heroNode6);
        singleLinkedList.addByOrder(heroNode7);
        singleLinkedList.addByOrder(heroNode8);

        singleLinkedList.list();
/*//        翻转
        System.out.println("===============");
        singleLinkedList.fanzhuan2();
        singleLinkedList.list();*/
// 从尾到头打印,没有改变链表结构
/*        System.out.println("===============");
        singleLinkedList.reversePrint(singleLinkedList.gerhead());
        System.out.println("===============");
        singleLinkedList.list();*/
        System.out.println("======");
        singleLinkedList.fanzhuan();




//        翻转测试


//        删除测试
    /*    singleLinkedList.list();
        singleLinkedList.delete(4);
        singleLinkedList.delete(2);
        singleLinkedList.delete(4);
        System.out.println("============================");
        singleLinkedList.list();*/
/*//        先显示
        singleLinkedList.list();
        System.out.println("============================");
//        修改
        singleLinkedList.update(heroNode4);*/

//        显示
//        singleLinkedList.list();
    }
}
